<?php
class DBHelper {
	private $_host = 'localhost';
	private $_username = 'root';
	private $_password = '';
	private $_dbname = 'qlsv';
	public $_db;
	private $_fetchmode = PDO::FETCH_ASSOC;
	public function __construct() {
		$this->init ();
	}
	public function init() {
		$this->_db = new PDO ( 'mysql:host=' . $this->_host . ';dbname=' . $this->_dbname, $this->_username, $this->_password );
		$this->_db->setAttribute ( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
	}
	public function setFetchMode($newfetchmode) {
		$this->_fetchmode = $newfetchmode;
	}
	public function fetchAll($sql) {
		$statement = $this->_db->query ( $sql );
		$statement->execute ();
		$statement->setFetchMode ( $this->_fetchmode );
		return $statement->fetchAll ();
	}
	public function iOrU($st, $data) {
		$st->execute ( $data );
	}
	public function update() {
	}
	public function inserst() {
	}
	public function delete($sql) {
		return $this->_db->exec ( $sql );
	}
}

?>